home *** CD-ROM | disk | FTP | other *** search
/ APDL Eductation Resources / APDL Eductation Resources.iso / programs / graphics / gif2rpc / source / h / process_gi < prev   
Encoding:
Text File  |  1995-10-07  |  2.5 KB  |  100 lines

  1. /* process_gif.h
  2.  * AUTHOR:      Cy Booker, cy@cheepnis.demon.co.uk
  3.  * LICENSE:     FreeWare, Copyright (c) 1995 Cy Booker
  4.  * PURPOSE:     process an 8 bit image into another image `inline'
  5.  *              ie overwrite the source with the destination on a row-by row basis
  6.  *              obviously this means that if going 8 -> 16/32 bit then each row
  7.  *              needs to be wide enough, and we have to process right -> left
  8.  */
  9.  
  10. #ifndef process_gif_h
  11. #define process_gif_h
  12.  
  13. #include "OS:os.h"
  14.  
  15.  
  16.  
  17. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  18.  */
  19.  
  20. typedef struct fixedpalette     fixedpalette;
  21.  
  22. struct fixedpalette {
  23.   os_colour     *colours;             /* ncolours entries */
  24.   int           ncolours;
  25. };
  26.  
  27.  
  28.  
  29. /*
  30.  * holds a 48-bit colour specified in RGB space
  31.  * the number (when normalised) holds values 0 (no intensity) to 0xffff (full intensity)
  32.  */
  33.  
  34. typedef struct rgbtuple                 rgbtuple;
  35.  
  36. struct rgbtuple {
  37.         int     red;
  38.         int     grn;
  39.         int     blu;
  40. };
  41.  
  42.  
  43.  
  44. typedef struct fixedrgbtuples     fixedrgbtuples;
  45.  
  46. struct fixedrgbtuples {
  47.   rgbtuple      *colours;             /* ncolours entries */
  48.   int           ncolours;
  49. };
  50.  
  51.  
  52.  
  53. /*
  54.  * this structure is used when processing images, the output palette is not used for
  55.  * processing to 16bpp images
  56.  */
  57.  
  58. typedef struct rgbtupleout              rgbtupleout;
  59.  
  60. struct rgbtupleout {
  61.         rgbtuple                colour;
  62.         fixedrgbtuples          palette;        /* destination palette, if <= 256 colours */
  63. };
  64.  
  65.  
  66.  
  67. typedef bits (*rgbtupleout_fn)(rgbtupleout *, int, int, int);
  68.  
  69.  
  70. typedef struct process_gif      process_gif;
  71.  
  72. struct process_gif {
  73.   byte                  *buffer;        /* i/o (must be word-aligned) */
  74.   int                   pixel_width;    /* > 0 */
  75.   int                   pixel_height;   /* > 0 */
  76.   int                   line_length;    /* must be word-aligned for some processing */
  77.   fixedpalette          in_palette;     /* only used by some routines */
  78.   fixedrgbtuples        out_palette;    /* only used when outputting 8bpp images */
  79.   rgbtupleout_fn        fn;
  80. };
  81.  
  82.  
  83.  
  84. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  85.  *
  86.  * this uses the in_palette, and fn members to calculate a mapping from input colour to
  87.  * output colour number
  88.  * the fn may use the out_palette member (particularly if output to <= 256 colours)
  89.  *
  90.  */
  91.  
  92.  
  93. extern void process_gif_calc_pixtrans(
  94.                 const process_gif       *p,
  95.                 bits                    *pixtrans);
  96.  
  97.  
  98.  
  99. #endif /* process_gif_h */
  100.